package org.hades.corelib.base.view.baseimpl

import androidx.activity.viewModels
import kotlinx.coroutines.flow.StateFlow
import org.hades.corelib.R
import org.hades.corelib.base.data.ResultData
import org.hades.corelib.base.view.CoreActivity
import org.hades.corelib.base.vm.CoreViewModel
import org.hades.corelib.base.widget.TitleBar

abstract class TitleActivity(): CoreActivity() {

    // 用来处理事件监听：异常、loading等
    private val viewModel: CoreViewModel by viewModels()

    override fun onGetViewModel(): CoreViewModel {
        return viewModel
    }

    protected fun initToolBar(titleBar: TitleBar){
        setSupportActionBar(titleBar)
        setNavBack(titleBar)
    }

    protected fun setNavBack(titleBar: TitleBar) {
        titleBar.setNavigationOnClickListener{
            onBackPressed()
        }
    }



}